﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AudioPlayer.Plugin.Storage {
	/// <summary>
	/// Provides user settings caching.
	/// </summary>
	public interface ISettings : IPlugin {

		/// <summary>
		/// Add user setting.
		/// </summary>
		/// <typeparam name="TField">The type of the field.</typeparam>
		/// <param name="owner">The Owner.</param>
		/// <param name="name">The Name or setting.</param>
		/// <param name="value">The value.</param>
		void Set<TField>(Guid owner, String name, TField value);

		/// <summary>
		/// Removes the specified setting
		/// </summary>
		/// <param name="owner">The Owner.</param>
		/// <param name="name">The Name of setting.</param>
		void Remove(Guid owner, String name);

		/// <summary>
		/// Gets the specified value from owner, with specified name.
		/// </summary>
		/// <typeparam name="TField">The type of the field.</typeparam>
		/// <param name="owner">The Owner.</param>
		/// <param name="name">The Name of Setting.</param>
		/// <returns>NULL if not founds, or TField as value</returns>
		TField Get<TField>(Guid owner, String name);

		/// <summary>
		/// Gets the specified value from owner, with specified name.
		/// </summary>
		/// <typeparam name="TField">The type of the field.</typeparam>
		/// <param name="owner">The Owner.</param>
		/// <param name="name">The Name of Setting.</param>
		/// <param name="def">The default value to return.</param>
		/// <returns>Value, or default value</returns>
		TField Get<TField>(Guid owner, String name, TField def);

		/// <summary>
		/// Gets all names with founded owner.
		/// </summary>
		/// <returns>NULL if GUID doesn't contain any values, or Array.</returns>
		String[] Get(Guid owner);
	}
}
